home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
59454
/
59454.xpi
/
content
/
Bubble.js
next >
Wrap
Text File
|
2010-01-25
|
3KB
|
100 lines
BartUniversalSearch.BubbleClass = BartUtils.defineClass(
{
name: "UniversalSearchBubbleClass",
construct: function()
{
this.bubble = null;
this.bubbleId = "UniversalSearchContextBubbleId";
},
methods:
{
_createElement: function(doc, name, cssClass)
{
var e = doc.createElement(name);
if(cssClass)
{
//e.setAttribute("style", cssClass);
e.setAttribute("class", cssClass);
}
return e;
},
removeBubble: function()
{
if(this.bubble)
{
var doc = this.bubble.ownerDocument;
var bubble;
do
{
bubble = doc.getElementById(this.bubbleId);
if(bubble)
bubble.parentNode.removeChild(bubble);
} while(bubble != null);
this.bubble = null;
}
},
getBubble: function()
{
return this.bubble;
},
createBubble: function(doc, icons)
{
this.removeBubble();
var root = this._createElement(doc, "span", "universalsearch-bubble");
var inner = "";
inner += "<span class=\"universalsearch-bubble-body\" onmouseover=\"this.parentNode.style.MozOpacity=1; if(this.parentNode.filters && this.parentNode.filters.alpha) this.parentNode.filters.alpha.opacity=100;\" "
+ " onmouseout=\"this.parentNode.style.MozOpacity=0.6;if(this.parentNode.filters && this.parentNode.filters.alpha) this.parentNode.filters.alpha.opacity==60;\""
+ " onselectstart=\"return false;\" ondragstart=\"return false;\">";
inner += "<span class=\"universalsearch-bubble-iconframe\">";
for(var i = 0; i < icons.length; i++)
{
inner += icons[i];
}
inner += "</span></span>";
root.innerHTML = inner;
this.bubble = root;
this.bubble.setAttribute("id", this.bubbleId);
return root;
},
/**
* Generate an HTML element htmlText, which is a <a> element with an <img> child element.
* Every parameter should be an associative array.
*/
createIcon: function(imgProps, linkProps)
{
var a = "<a ";
var p;
for(p in linkProps)
{
a += p;
a += "=\"" + linkProps[p] + "\" ";
}
a += "><img ";
for(p in imgProps)
{
a += p;
a += "=\"" + imgProps[p] + "\" ";
}
a += " /></a>";
return a;
}
},
statics:
{
}
});